![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
The sha.js npm package is a module that provides cryptographic hash functions, specifically SHA (Secure Hash Algorithm) family functions. It allows for the generation of hash values from input data, which is a common requirement in various security contexts, such as password hashing, data integrity checks, and digital signatures.
SHA-256 Hash Generation
This feature allows for the generation of SHA-256 hash values from input strings. The code sample demonstrates how to create a SHA-256 hash of the string 'hello world' and output it in hexadecimal format.
"use strict";\nconst sha256 = require('sha.js').sha256;\nconst hash = new sha256().update('hello world').digest('hex');\nconsole.log(hash);
SHA-512 Hash Generation
This feature enables the creation of SHA-512 hash values. The provided code sample shows how to generate a SHA-512 hash for the input 'hello world' and print the result in hex format.
"use strict";\nconst sha512 = require('sha.js').sha512;\nconst hash = new sha512().update('hello world').digest('hex');\nconsole.log(hash);
Crypto-js is a package that offers a variety of cryptographic algorithms, including SHA-1, SHA-256, and SHA-512, similar to sha.js. However, it also provides many other algorithms like AES and Rabbit, making it more versatile for different cryptographic needs.
Node-forge is a comprehensive Node.js module that includes not only SHA hash functions but also other cryptographic tools like encryption, decryption, and digital signatures. It's more complex and feature-rich compared to sha.js, which focuses mainly on SHA hash functions.
Node style SHA
on pure JavaScript.
var shajs = require('sha.js')
console.log(shajs('sha256').update('42').digest('hex'))
// => 73475cb40a568e8da8a045ced110137e159f890ac4da883b6b17dc651b3a8049
console.log(new shajs.sha256().update('42').digest('hex'))
// => 73475cb40a568e8da8a045ced110137e159f890ac4da883b6b17dc651b3a8049
var sha256stream = shajs('sha256')
sha256stream.end('42')
console.log(sha256stream.read().toString('hex'))
// => 73475cb40a568e8da8a045ced110137e159f890ac4da883b6b17dc651b3a8049
sha.js
currently implements:
Note, this doesn't actually implement a stream, but wrapping this in a stream is trivial. It does update incrementally, so you can hash things larger than RAM, as it uses a constant amount of memory (except when using base64 or utf8 encoding, see code comments).
This work is derived from Paul Johnston's A JavaScript implementation of the Secure Hash Algorithm.
FAQs
Streamable SHA hashes in pure javascript
The npm package sha.js receives a total of 2,291,787 weekly downloads. As such, sha.js popularity was classified as popular.
We found that sha.js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.